package greedy.onClass.class2.exer03;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int max = sc.nextInt();
        int n = sc.nextInt();
        int[] scoreArr = new int[n];
        for (int i = 0; i < n; i++) {
            scoreArr[i] = sc.nextInt();
        }
        Arrays.sort(scoreArr);
        int left = 0;
        int right = scoreArr.length - 1;
        int pairs = 0;
        while (right >= left) {
            if (left == right) {
                pairs++;
                break;
            }
            if (scoreArr[right] + scoreArr[left] <= max) {
                pairs++;
                right--;
                left++;
            } else {
                pairs++;
                right--;
            }
        }
        System.out.println(pairs);
    }
}
